/**
 * @author Phuc "Noel" Vo
 */
package com.example.noelwhereismystuffs.views.UserProfileActivity;

import com.example.noelproject.R;
import com.example.noelwhereismystuffs.models.Database;
import com.example.noelwhereismystuffs.models.User;
import com.example.noelwhereismystuffs.models.UserProfileModel;
import com.example.noelwhereismystuffs.presenters.UserProfilePresenter;
import com.example.noelwhereismystuffs.views.DisplayLostItemsActivity.DisplayLostItemsActivity;
import com.example.noelwhereismystuffs.views.ReportItemsActivity.ReportItemsActivity;
import com.example.noelwhereismystuffs.views.SignInActivity.SignInActivity;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;

public class UserProfileActivity extends Activity implements IUserProfileView {
	/** The list of lost items to display */
	@SuppressWarnings("unused")
	private UserProfilePresenter myPresenter;
	private User myUser = User.NULL_USER;
	private Database myData;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_user_profile);
		/** create the activity presenter */
		myPresenter = new UserProfilePresenter(this, new UserProfileModel());
		// Retrieve the user passed from SigInActivity
		myUser = (User) getIntent().getSerializableExtra("User");
		myData = (Database) getIntent().getSerializableExtra("Database");
	}

	/**
	 * Handle Log-out button
	 * 
	 * @param source
	 */

	public void onLogOutClick(View source) {
		advanceLogOut();
	}

	/**
	 * Handle Lost button
	 * @param source
	 */
	public void onLostItemsClick(View source) {
		advanceLost();
	}

	/**
	 * Handle Found button
	 * @param source
	 */
	public void onFoundItemsClick(View source) {
		advanceFound();
	}
	
	/**
	 * Handle Donate button
	 * @param source
	 */
	public void onDonateItemsClick(View source) {
		advanceDonate();
	}

	/**
	 * Handle Report button
	 * @param source
	 */
	public void onReportItemsClick(View source) {
		advanceReport();
	}

	@Override
	public void advanceReport() {
		// create an intent (a request for phone OS to do something)
		Intent intent = new Intent(this, ReportItemsActivity.class);
		// Pass the user to the DisplayLostItemsActivity
		intent.putExtra("User", myUser);
		intent.putExtra("Database", myData);
		// now pass that to the phone OS and ask to start it
		startActivity(intent);
	}

	@Override
	public void advanceLogOut() {
		// create an intent (a request for phone OS to do something)
		Intent intent = new Intent(this, SignInActivity.class);
		// now pass that to the phone OS and ask to start it
		startActivity(intent);

	}

	@Override
	public void advanceLost() {
		// create an intent (a request for phone OS to do something)
		Intent intent = new Intent(this, DisplayLostItemsActivity.class);
		// Pass the user to the DisplayLostItemsActivity
		intent.putExtra("User", myUser);
		intent.putExtra("Database", myData);
		// now pass that to the phone OS and ask to start it
		startActivity(intent);
	}

	@Override
	public void advanceFound() {
		// TODO Auto-generated method stub

	}

	@Override
	public void advanceDonate() {
		// TODO Auto-generated method stub

	}

}
